home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Mailbox/MIME Entity
(archive/mbox).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| Mailbox/MIME Entity (archive/mbox)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news text
| default
| |
99%
| file
| C++ source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| dexmagic
| PrintFox/Pagefox WEAK
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/950 MIME Email (1.0)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/news
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 65 6e | 67 6e 65 77 73 31 2e 45 |Path: en|gnews1.E|
|00000010| 6e 67 2e 53 75 6e 2e 43 | 4f 4d 21 75 73 65 6e 65 |ng.Sun.C|OM!usene|
|00000020| 74 0a 46 72 6f 6d 3a 20 | 52 41 4a 55 20 41 4c 4c |t.From: |RAJU ALL|
|00000030| 55 52 49 20 3c 72 61 6a | 75 2e 61 6c 6c 75 72 69 |URI <raj|u.alluri|
|00000040| 40 53 75 6e 2e 43 4f 4d | 3e 0a 4e 65 77 73 67 72 |@Sun.COM|>.Newsgr|
|00000050| 6f 75 70 73 3a 20 63 6f | 6d 70 2e 6c 61 6e 67 2e |oups: co|mp.lang.|
|00000060| 63 2b 2b 0a 53 75 62 6a | 65 63 74 3a 20 52 65 3a |c++.Subj|ect: Re:|
|00000070| 20 5b 5d 20 6f 76 65 72 | 6c 6f 61 64 2e 2e 28 6e | [] over|load..(n|
|00000080| 65 77 62 69 65 20 69 6e | 20 64 69 73 74 72 65 73 |ewbie in| distres|
|00000090| 73 29 0a 44 61 74 65 3a | 20 32 32 20 4a 61 6e 20 |s).Date:| 22 Jan |
|000000a0| 31 39 39 36 20 32 32 3a | 32 30 3a 31 32 20 47 4d |1996 22:|20:12 GM|
|000000b0| 54 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |T.Organi|zation: |
|000000c0| 53 75 6e 20 4d 69 63 72 | 6f 73 79 73 74 65 6d 73 |Sun Micr|osystems|
|000000d0| 20 49 6e 63 2e 2c 20 4d | 6f 75 6e 74 61 69 6e 20 | Inc., M|ountain |
|000000e0| 56 69 65 77 2c 20 43 41 | 0a 4d 65 73 73 61 67 65 |View, CA|.Message|
|000000f0| 2d 49 44 3a 20 3c 34 65 | 31 32 69 73 24 35 6e 6f |-ID: <4e|12is$5no|
|00000100| 40 65 6e 67 6e 65 77 73 | 31 2e 45 6e 67 2e 53 75 |@engnews|1.Eng.Su|
|00000110| 6e 2e 43 4f 4d 3e 0a 52 | 65 66 65 72 65 6e 63 65 |n.COM>.R|eference|
|00000120| 73 3a 20 3c 44 4c 47 70 | 70 4a 2e 33 31 43 40 75 |s: <DLGp|pJ.31C@u|
|00000130| 6e 64 65 72 67 72 61 64 | 2e 6d 61 74 68 2e 75 77 |ndergrad|.math.uw|
|00000140| 61 74 65 72 6c 6f 6f 2e | 63 61 3e 09 3c 52 6f 62 |aterloo.|ca>.<Rob|
|00000150| 65 72 74 2e 4c 65 6e 64 | 76 61 69 2d 32 31 30 31 |ert.Lend|vai-2101|
|00000160| 39 36 30 31 31 38 33 33 | 30 30 30 31 40 31 32 39 |96011833|0001@129|
|00000170| 2e 31 37 30 2e 38 30 2e | 39 34 3e 09 3c 34 64 74 |.170.80.|94>.<4dt|
|00000180| 75 61 6d 24 68 66 34 40 | 6e 65 77 73 2e 78 6d 69 |uam$hf4@|news.xmi|
|00000190| 73 73 69 6f 6e 2e 63 6f | 6d 3e 20 3c 41 4c 55 4e |ssion.co|m> <ALUN|
|000001a0| 2e 43 48 41 4d 50 49 4f | 4e 2e 39 36 4a 61 6e 32 |.CHAMPIO|N.96Jan2|
|000001b0| 32 31 34 33 34 32 32 40 | 67 37 32 34 30 30 36 35 |2143422@|g7240065|
|000001c0| 2e 62 72 69 64 67 65 2e | 62 73 74 2e 62 6c 73 2e |.bridge.|bst.bls.|
|000001d0| 63 6f 6d 3e 0a 4e 4e 54 | 50 2d 50 6f 73 74 69 6e |com>.NNT|P-Postin|
|000001e0| 67 2d 48 6f 73 74 3a 20 | 6e 61 6e 61 6b 2e 65 6e |g-Host: |nanak.en|
|000001f0| 67 2e 73 75 6e 2e 63 6f | 6d 0a 4d 69 6d 65 2d 56 |g.sun.co|m.Mime-V|
|00000200| 65 72 73 69 6f 6e 3a 20 | 31 2e 30 0a 43 6f 6e 74 |ersion: |1.0.Cont|
|00000210| 65 6e 74 2d 54 79 70 65 | 3a 20 74 65 78 74 2f 70 |ent-Type|: text/p|
|00000220| 6c 61 69 6e 3b 20 63 68 | 61 72 73 65 74 3d 75 73 |lain; ch|arset=us|
|00000230| 2d 61 73 63 69 69 0a 43 | 6f 6e 74 65 6e 74 2d 54 |-ascii.C|ontent-T|
|00000240| 72 61 6e 73 66 65 72 2d | 45 6e 63 6f 64 69 6e 67 |ransfer-|Encoding|
|00000250| 3a 20 37 62 69 74 0a 58 | 2d 4d 61 69 6c 65 72 3a |: 7bit.X|-Mailer:|
|00000260| 20 4d 6f 7a 69 6c 6c 61 | 20 31 2e 31 32 53 55 4e | Mozilla| 1.12SUN|
|00000270| 20 28 58 31 31 3b 20 49 | 3b 20 53 75 6e 4f 53 20 | (X11; I|; SunOS |
|00000280| 35 2e 34 20 73 75 6e 34 | 63 29 0a 54 6f 3a 20 41 |5.4 sun4|c).To: A|
|00000290| 6c 75 6e 2e 43 68 61 6d | 70 69 6f 6e 40 62 72 69 |lun.Cham|pion@bri|
|000002a0| 64 67 65 2e 62 73 74 2e | 62 6c 73 2e 63 6f 6d 0a |dge.bst.|bls.com.|
|000002b0| 58 2d 55 52 4c 3a 20 6e | 65 77 73 3a 41 4c 55 4e |X-URL: n|ews:ALUN|
|000002c0| 2e 43 48 41 4d 50 49 4f | 4e 2e 39 36 4a 61 6e 32 |.CHAMPIO|N.96Jan2|
|000002d0| 32 31 34 33 34 32 32 40 | 67 37 32 34 30 30 36 35 |2143422@|g7240065|
|000002e0| 2e 62 72 69 64 67 65 2e | 62 73 74 2e 62 6c 73 2e |.bridge.|bst.bls.|
|000002f0| 63 6f 6d 0a 0a 41 6c 75 | 6e 2e 43 68 61 6d 70 69 |com..Alu|n.Champi|
|00000300| 6f 6e 40 62 72 69 64 67 | 65 2e 62 73 74 2e 62 6c |on@bridg|e.bst.bl|
|00000310| 73 2e 63 6f 6d 20 28 41 | 6c 75 6e 20 43 68 61 6d |s.com (A|lun Cham|
|00000320| 70 69 6f 6e 29 20 77 72 | 6f 74 65 3a 0a 0a 3e 20 |pion) wr|ote:..> |
|00000330| 20 20 54 26 20 6f 70 65 | 72 61 74 6f 72 20 5b 5d | T& ope|rator []|
|00000340| 20 28 69 6e 74 20 69 6e | 64 65 78 29 3b 0a 3e 20 | (int in|dex);.> |
|00000350| 20 20 54 20 6f 70 65 72 | 61 74 6f 72 20 5b 5d 20 | T oper|ator [] |
|00000360| 28 69 6e 74 20 69 6e 64 | 65 78 29 20 63 6f 6e 73 |(int ind|ex) cons|
|00000370| 74 3b 0a 3e 0a 3e 44 6f | 65 73 20 61 6e 79 6f 6e |t;.>.>Do|es anyon|
|00000380| 65 20 68 61 76 65 20 61 | 6e 79 20 67 6f 6f 64 20 |e have a|ny good |
|00000390| 72 65 61 73 6f 6e 73 20 | 6f 72 20 72 65 66 65 72 |reasons |or refer|
|000003a0| 65 6e 63 65 73 20 61 73 | 20 77 68 79 20 79 6f 75 |ences as| why you|
|000003b0| 20 73 68 6f 75 6c 64 20 | 64 65 66 69 6e 65 20 74 | should |define t|
|000003c0| 68 65 0a 3e 73 65 63 6f | 6e 64 20 6f 66 20 74 68 |he.>seco|nd of th|
|000003d0| 65 20 74 77 6f 20 6f 70 | 65 72 61 74 6f 72 20 5b |e two op|erator [|
|000003e0| 5d 27 73 20 69 66 20 79 | 6f 75 20 70 72 6f 76 69 |]'s if y|ou provi|
|000003f0| 64 65 20 74 68 65 20 66 | 69 72 73 74 20 3f 0a 3e |de the f|irst ?.>|
|00000400| 41 6e 64 20 69 66 20 69 | 74 20 69 73 20 6e 65 63 |And if i|t is nec|
|00000410| 65 73 73 61 72 79 20 77 | 68 61 74 20 69 73 20 74 |essary w|hat is t|
|00000420| 68 65 20 61 72 67 75 6d | 65 6e 74 20 61 67 61 69 |he argum|ent agai|
|00000430| 6e 73 74 0a 3e 0a 3e 20 | 20 20 63 6f 6e 73 74 20 |nst.>.> | const |
|00000440| 54 26 20 6f 70 65 72 61 | 74 6f 72 20 5b 5d 20 28 |T& opera|tor [] (|
|00000450| 69 6e 74 20 69 6e 64 65 | 78 29 20 63 6f 6e 73 74 |int inde|x) const|
|00000460| 3b 0a 3e 0a 3e 69 6e 73 | 74 65 61 64 20 3f 0a 3e |;.>.>ins|tead ?.>|
|00000470| 0a 0a 54 68 65 20 73 65 | 63 6f 6e 64 20 6f 70 65 |..The se|cond ope|
|00000480| 72 61 74 6f 72 20 66 75 | 6e 63 74 69 6f 6e 20 69 |rator fu|nction i|
|00000490| 73 20 75 73 65 66 75 6c | 20 66 6f 72 20 63 6f 6e |s useful| for con|
|000004a0| 73 74 61 6e 74 20 6f 62 | 6a 65 63 74 73 20 6f 66 |stant ob|jects of|
|000004b0| 20 74 68 65 20 74 79 70 | 65 2e 0a 49 66 20 79 6f | the typ|e..If yo|
|000004c0| 75 20 77 61 6e 74 20 74 | 6f 20 75 73 65 20 74 68 |u want t|o use th|
|000004d0| 65 20 6f 70 65 72 61 74 | 6f 72 5b 5d 20 6f 6e 20 |e operat|or[] on |
|000004e0| 61 20 63 6f 6e 73 74 61 | 6e 74 20 6f 62 6a 65 63 |a consta|nt objec|
|000004f0| 74 2c 20 28 75 73 75 61 | 6c 6c 79 0a 6e 6f 74 20 |t, (usua|lly.not |
|00000500| 6f 6e 20 74 68 65 20 6c | 65 66 74 20 73 69 64 65 |on the l|eft side|
|00000510| 20 6f 66 20 61 6e 20 61 | 73 73 69 67 6e 6d 65 6e | of an a|ssignmen|
|00000520| 74 2c 20 62 75 74 20 6f | 6e 20 74 68 65 20 72 69 |t, but o|n the ri|
|00000530| 67 68 74 20 68 61 6e 64 | 20 73 69 64 65 29 0a 74 |ght hand| side).t|
|00000540| 68 65 6e 20 74 68 65 20 | 66 69 72 73 74 20 6f 70 |hen the |first op|
|00000550| 65 72 61 74 6f 72 20 66 | 75 6e 63 74 69 6f 6e 20 |erator f|unction |
|00000560| 63 61 6e 6e 6f 74 20 62 | 65 20 75 73 65 64 2e 20 |cannot b|e used. |
|00000570| 28 43 6f 6e 73 74 61 6e | 74 20 6f 62 6a 65 63 74 |(Constan|t object|
|00000580| 73 20 63 61 6e 0a 62 65 | 20 6f 70 65 72 61 74 65 |s can.be| operate|
|00000590| 64 20 77 69 74 68 20 63 | 6f 6e 73 74 61 6e 74 20 |d with c|onstant |
|000005a0| 6d 65 6d 62 65 72 73 20 | 6f 6e 6c 79 2e 29 0a 0a |members |only.)..|
|000005b0| 4e 61 74 75 72 61 6c 6c | 79 2c 20 79 6f 75 20 77 |Naturall|y, you w|
|000005c0| 6f 75 6c 64 20 6c 69 6b | 65 20 74 68 65 20 63 6f |ould lik|e the co|
|000005d0| 6e 73 74 6e 65 73 73 20 | 6f 66 20 74 68 65 20 6f |nstness |of the o|
|000005e0| 62 6a 65 63 74 20 62 65 | 69 6e 67 20 75 6e 64 69 |bject be|ing undi|
|000005f0| 73 74 75 72 62 65 64 2c | 0a 61 74 20 74 68 65 20 |sturbed,|.at the |
|00000600| 73 61 6d 65 20 74 69 6d | 65 2c 20 61 63 63 65 73 |same tim|e, acces|
|00000610| 73 69 6e 67 20 74 68 65 | 20 63 6f 6e 74 65 6e 74 |sing the| content|
|00000620| 73 20 6f 66 20 74 68 65 | 20 63 6f 6e 73 74 61 6e |s of the| constan|
|00000630| 74 20 6f 62 6a 65 63 74 | 20 62 79 20 6d 65 61 6e |t object| by mean|
|00000640| 73 0a 69 6e 64 65 78 69 | 6e 67 2e 0a 0a 54 68 65 |s.indexi|ng...The|
|00000650| 6e 20 6c 65 74 20 75 73 | 20 63 6f 6d 65 20 74 6f |n let us| come to|
|00000660| 20 74 68 65 20 74 68 69 | 72 64 20 6d 65 6d 62 65 | the thi|rd membe|
|00000670| 72 20 66 75 6e 63 74 69 | 6f 6e 3a 0a 20 20 20 63 |r functi|on:. c|
|00000680| 6f 6e 73 74 20 54 26 20 | 6f 70 65 72 61 74 6f 72 |onst T& |operator|
|00000690| 20 5b 5d 20 28 69 6e 74 | 20 69 6e 64 65 78 29 20 | [] (int| index) |
|000006a0| 63 6f 6e 73 74 3b 0a 52 | 65 6d 65 6d 62 65 72 2c |const;.R|emember,|
|000006b0| 20 69 74 20 72 65 74 75 | 72 6e 73 20 61 20 72 65 | it retu|rns a re|
|000006c0| 66 65 72 65 6e 63 65 20 | 28 65 76 65 6e 20 74 68 |ference |(even th|
|000006d0| 6f 75 67 68 20 69 74 20 | 69 73 20 61 20 63 6f 6e |ough it |is a con|
|000006e0| 73 74 61 6e 74 29 0a 4d | 6f 73 74 20 6f 66 20 74 |stant).M|ost of t|
|000006f0| 68 65 20 63 6f 6d 70 69 | 6c 65 72 73 20 61 6c 6c |he compi|lers all|
|00000700| 6f 77 20 79 6f 75 20 74 | 6f 20 45 58 50 4c 49 43 |ow you t|o EXPLIC|
|00000710| 49 54 4c 59 20 74 79 70 | 65 20 63 6f 6e 76 65 72 |ITLY typ|e conver|
|00000720| 74 20 61 20 63 6f 6e 73 | 74 61 6e 74 20 0a 72 65 |t a cons|tant .re|
|00000730| 66 65 72 65 6e 63 65 20 | 74 6f 20 61 6e 20 6e 6f |ference |to an no|
|00000740| 6e 2d 63 6f 6e 73 74 61 | 6e 74 20 6f 6e 65 2c 20 |n-consta|nt one, |
|00000750| 61 6e 64 20 69 66 20 69 | 74 20 69 73 20 64 6f 6e |and if i|t is don|
|00000760| 65 2c 20 74 68 65 20 63 | 6f 6e 73 74 6e 65 73 73 |e, the c|onstness|
|00000770| 20 0a 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 20 | .of the| object |
|00000780| 69 73 20 6c 6f 73 74 2e | 0a 48 65 6e 63 65 20 74 |is lost.|.Hence t|
|00000790| 68 65 20 73 65 63 6f 6e | 64 20 63 6f 6e 73 74 72 |he secon|d constr|
|000007a0| 75 63 74 20 69 73 20 61 | 20 62 65 74 74 65 72 20 |uct is a| better |
|000007b0| 6f 6e 65 20 74 68 61 6e | 20 74 68 65 20 74 68 69 |one than| the thi|
|000007c0| 72 64 20 63 6f 6e 73 74 | 72 75 63 74 2e 0a 0a 48 |rd const|ruct...H|
|000007d0| 65 72 65 20 69 73 20 61 | 20 73 6d 61 6c 6c 20 65 |ere is a| small e|
|000007e0| 78 61 6d 70 6c 65 20 66 | 6f 72 20 74 68 65 20 61 |xample f|or the a|
|000007f0| 62 6f 76 65 20 64 69 73 | 63 75 73 73 69 6f 6e 2e |bove dis|cussion.|
|00000800| 0a 0a 63 6c 61 73 73 20 | 41 72 72 61 79 20 7b 0a |..class |Array {.|
|00000810| 09 69 6e 74 20 62 61 73 | 65 5b 4d 41 58 5f 4c 45 |.int bas|e[MAX_LE|
|00000820| 4e 47 54 48 5d 3b 0a 0a | 09 2f 2f 20 2e 2e 2e 2e |NGTH];..|.// ....|
|00000830| 2e 2e 2e 0a 0a 20 20 20 | 20 70 75 62 6c 69 63 20 |..... | public |
|00000840| 3a 0a 09 09 2f 2f 20 46 | 6f 72 20 6e 6f 6e 20 63 |:...// F|or non c|
|00000850| 6f 6e 73 74 61 6e 74 20 | 6f 62 6a 65 63 74 73 0a |onstant |objects.|
|00000860| 09 69 6e 74 20 26 20 6f | 70 65 72 61 74 6f 72 5b |.int & o|perator[|
|00000870| 5d 20 28 69 6e 74 20 69 | 6e 64 65 78 29 20 7b 20 |] (int i|ndex) { |
|00000880| 72 65 74 75 72 6e 20 62 | 61 73 65 5b 69 6e 64 65 |return b|ase[inde|
|00000890| 78 5d 3b 20 7d 0a 09 09 | 2f 2f 20 46 6f 72 20 63 |x]; }...|// For c|
|000008a0| 6f 6e 73 74 61 6e 74 20 | 6f 62 6a 65 63 74 73 0a |onstant |objects.|
|000008b0| 09 69 6e 74 20 20 20 6f | 70 65 72 61 74 6f 72 5b |.int o|perator[|
|000008c0| 5d 20 28 69 6e 74 20 69 | 6e 64 65 78 29 20 63 6f |] (int i|ndex) co|
|000008d0| 6e 73 74 20 7b 20 72 65 | 74 75 72 6e 20 62 61 73 |nst { re|turn bas|
|000008e0| 65 5b 69 6e 64 65 78 5d | 3b 20 7d 0a 20 20 20 20 |e[index]|; }. |
|000008f0| 7d 3b 0a 0a 76 6f 69 64 | 20 66 6f 6f 28 20 41 72 |};..void| foo( Ar|
|00000900| 72 61 79 20 61 2c 20 63 | 6f 6e 73 74 20 41 72 72 |ray a, c|onst Arr|
|00000910| 61 79 20 63 61 20 29 0a | 7b 0a 09 61 5b 32 5d 20 |ay ca ).|{..a[2] |
|00000920| 3d 20 31 30 30 3b 09 2f | 2f 20 46 69 6e 65 21 20 |= 100;./|/ Fine! |
|00000930| 63 61 6c 6c 73 20 66 69 | 72 73 74 20 6f 6e 65 21 |calls fi|rst one!|
|00000940| 0a 09 61 5b 33 5d 20 3d | 20 63 61 5b 33 5d 09 2f |..a[3] =| ca[3]./|
|00000950| 2f 20 46 69 6e 65 21 20 | 63 61 6c 6c 73 20 66 69 |/ Fine! |calls fi|
|00000960| 72 73 74 20 6f 6e 65 20 | 6f 6e 20 61 20 61 6e 64 |rst one |on a and|
|00000970| 20 73 65 63 6f 6e 64 20 | 6f 6e 65 20 6f 6e 20 63 | second |one on c|
|00000980| 61 21 0a 09 63 61 5b 32 | 5d 20 3d 20 32 30 30 3b |a!..ca[2|] = 200;|
|00000990| 09 2f 2f 20 45 72 72 6f | 72 21 20 72 65 74 75 72 |.// Erro|r! retur|
|000009a0| 6e 20 76 61 6c 75 65 20 | 6f 66 20 73 65 63 6f 6e |n value |of secon|
|000009b0| 64 20 5b 5d 20 6f 70 65 | 72 61 74 6f 72 20 69 73 |d [] ope|rator is|
|000009c0| 20 6e 6f 74 20 61 6e 0a | 09 09 09 2f 2f 20 20 20 | not an.|...// |
|000009d0| 20 20 20 20 20 6c 76 61 | 6c 75 65 21 0a 7d 0a 0a | lva|lue!.}..|
|000009e0| 49 6e 73 74 65 61 64 2c | 20 69 66 20 79 6f 75 20 |Instead,| if you |
|000009f0| 75 73 65 20 74 68 65 20 | 74 68 69 72 64 20 74 79 |use the |third ty|
|00000a00| 70 65 20 6f 66 20 66 75 | 6e 63 74 69 6f 6e 20 66 |pe of fu|nction f|
|00000a10| 6f 72 20 74 68 65 20 63 | 6f 6e 73 74 61 6e 74 20 |or the c|onstant |
|00000a20| 6f 62 6a 65 63 74 73 2c | 0a 74 68 65 6e 20 73 6f |objects,|.then so|
|00000a30| 6d 65 20 77 69 63 6b 65 | 64 20 66 65 6c 6c 6f 77 |me wicke|d fellow|
|00000a40| 20 6c 69 6b 65 20 6d 65 | 20 63 61 6e 20 64 6f 20 | like me| can do |
|00000a50| 6c 69 6b 65 0a 09 28 69 | 6e 74 20 26 29 28 63 61 |like..(i|nt &)(ca|
|00000a60| 5b 32 5d 29 20 3d 20 32 | 30 30 3b 0a 61 6e 64 20 |[2]) = 2|00;.and |
|00000a70| 6d 61 6b 65 20 74 68 65 | 20 63 6f 6e 73 74 61 6e |make the| constan|
|00000a80| 74 20 6f 62 6a 65 63 74 | 20 63 68 61 6e 67 65 64 |t object| changed|
|00000a90| 21 0a 0a 54 68 61 6e 6b | 20 79 6f 75 2e 0a 0a |!..Thank| you... |
+--------+-------------------------+-------------------------+--------+--------+